package com.flower.enjoyment.flower.mapper;

import com.flower.enjoyment.flower.entity.OrderInfo;
import com.flower.enjoyment.flower.entityDo.OrderInfoDo;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;

public interface OrderInfoMapper {
    int deleteByPrimaryKey(String id);

    int insert(OrderInfo record);

    int insertSelective(OrderInfo record);

    OrderInfoDo selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(OrderInfo record);

    int updateByPrimaryKeyWithBLOBs(OrderInfo record);

    int updateByPrimaryKey(OrderInfo record);

    /**
     * 获取用户消费记录
     * @param userId
     * @return
     */
    Page<OrderInfoDo> getSuccessOrderListByPage(@Param("userId") String userId);

    /**
     * 门店收入列表
     * @param shopId
     * @param type
     * @return
     */
    Page<OrderInfoDo> getShopIncomeOrderListByPage(@Param("shopId") String shopId,@Param("type") String type);

    /**
     * 根据订单号获取订单信息
     * @param orderNo
     * @return
     */
    OrderInfoDo selectByOrderNo(@Param("orderNo") String orderNo);

    /**
     * 根据用户id和商铺id判断该用户是否再此店铺消费过
     * @param userId
     * @param shopId
     * @return
     */
    int selectCountByUserIdShopId(@Param("userId") String userId,@Param("shopId") String shopId);

    /**
     * 今日收入
     * @param userId
     * @return
     */
    double selectSumAmountByToday(@Param("userId") String userId);

    /**
     * 全部收入
     * @param userId
     * @return
     */
    double selectSumAmountByAll(@Param("userId") String userId);

    /**
     * 将订单置为过期
     * @return
     */
    int updateExpireOrder();

}